<template>
	<view class="center">
		<view class="header" style="color: #000000;" @tap="goBack(id)">
			<view class="arrow" style="padding-left: 10rpx;">
				<text class="cuIcon-back" style="color: #FFFFFF;"></text>
			</view>
			<view class="title" style="color: #FFFFFF;">
				提现
			</view>
		</view>
		<view class="mone-text">
			<view class="mb38" style="font-weight: 300;">
				可提现金额（元）
			</view>
			<text class=" fs56">
				{{money}}
			</text>
			<view class="query" @tap="goToback('/pages/site/detailList')">
				<text class="cuIcon-pay" style="margin-right: 10rpx;"></text>查看明细
			</view>
		</view>
		
		<!-- <view class="bgc-top r10 flex align-center justify-around" >
			<view class="w200 h112 r10 lh112 text-center" style="border: 1rpx solid #525296;"
				v-for="(item, index) in 3">
				100 元
			</view>
		</view> -->
		<view class="input-box wh96 padding-left">
			<text class="cuIcon-info"></text>
			<text style="margin-left: 6rpx;">到账可能出现延迟，请注意留意到账情况</text>
		</view>
		
		
		
		<view class="input-mone r10">
			<view class="">
				手动输入
			</view>
			<view class="flex align-center padding-top">
				<text class="cuIcon-recharge fs26" ></text>
				<input type="text" v-model="mone" placeholder="请输入提现金额"
					style="display: inline-block;
					width: 90%; font-size: 26rpx;
					border-bottom: 1rpx solid #EEEEEE;
					padding-left: 10rpx;" />
			</view>
			
		</view>
		
		<view class="add" @tap="addMone">
			立即提现
		</view>

		<view class="foot_box"></view>
		<!-- 加载提示 -->
		<yy-loading text="加载中.." mask="true" click="true" ref="loading"></yy-loading>
		<!-- 信息提示-->
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mone: '',
				money: '',
			};
		},
		onShow() {},
		onLoad(e) {
			this.userInfo()
		},
		methods: {
			clkOn() {
				this.z.load(this);
				setTimeout(() => {
					this.z.load(this, 0);
				}, 3000);
			},
			
			goToback(url) {
				uni.navigateTo({
					url,
				})
			},

			goBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			
			async userInfo() {
				const res = await this.$u.post('api/hotel/me?uid=' + uni.getStorageSync('uid'))
				this.money = res.data.money
			},
			
			async addMone() {
				if( this.mone > this.money ) return this.$tools.msg('提现金额过大！')
				
				const res = await this.$u.post("api/hotel/add_tixian",{
					user_id: uni.getStorageSync('uid'),
					money: this.mone,
				})
				if (res.code == 1) {
					this.$tools.msg('申请成功！')
					
					setTimeout( function() {
						uni.navigateBack({
							delta: 1
						})
					},1000)
					console.log('1111==>', 1111);
				}
				console.log('111',res)
			},
		}
	};
</script>

<style lang="scss" scoped>

	.center {
		width: 100vw;
		// height: 100vh;
		overflow: scroll;

		.header {
			width: 100%;
			height: 200rpx;
			line-height: 150rpx;
			display: flex;
			align-items: center;
			// padding-left: 10rpx;
			padding-top: 30rpx;
			font-size: 36rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			background: #525296;

			.arrow {
				position: relative;
				display: inline-block;
			}


			.title {
				margin: 0 auto;
			}
		}
		
		.query {
			position: fixed;
			right: 0;
			top: 260rpx;
			width: 184rpx;
			height: 60rpx;
			color: #FFFFFF;
			line-height: 60rpx;
			padding-left: 10rpx;
			border-radius: 30px 0px 0px 30px;
			background: rgba(190, 160, 110, 0.2);
		}

		.mone-text {
			color: #FFFFFF;
			padding: 0 22rpx;
			height: 275rpx;
			font-family: PingFang SC;
			font-weight: bold;
			background-color: #525296;
		}

		.input-box {
			font-size: 24rpx;
			font-weight: 500;
			color: #717171;
			margin: 0 auto;
			margin: 22rpx 0;
			font-family: PingFang SC;
		}
		
		.input-mone {
			width: 96%;
			margin: 0 auto;
			color: #000000;
			padding: 40rpx 26rpx;
			background-color: #FFFFFF !important;
		}

		.bgc-top {
			width: 96%;
			margin: -100rpx auto 0;
			padding: 30rpx;
			background-color: #FFFFFF !important;
		}
		
		.add {
			position: fixed;
			bottom: 200rpx;
			right: 40rpx;
			width: 90%;
			height: 100rpx;
			margin: 0 auto;
			text-align: center;
			line-height: 100rpx;
			border-radius: 50rpx;
			font-size: 26rpx;
			background: #525296;
			font-family: PingFang SC;
			color: #FFFFFF;
			opacity: 0.9;
		}

		// margin-top: -5rpx;
	}
</style>
